#!/usr/bin/env perl
# Time-stamp: <27 Apr 00 17:54:26 giron1>

=head1 NAME

 showglob.perl - shows all global variables

=head1 DESCRIPTION

shows all variables defined in a I<globals.pl> definition file

=head1 SEE ALSO

L<OPTIONS>,
L<GLOBALS>

=head1 AUTHOR

 $Id: showglob.perl,v 1.1 2007/10/08 09:26:03 schweitz Exp $
 Franck Giron

=head1 LOG

 $Log: showglob.perl,v $
 Revision 1.1  2007/10/08 09:26:03  schweitz
 version 2.4, lib vergessen

 Revision /main/6  17-Jan-2003.12:25:52  giron1
 Updating header to /usr/bin/env perl.
 
 Revision 1.5  2000/04/27 15:55:24  giron1
 Pod documentation updated


=cut

#----------------------------------------------------------------------
# perl packages
#----------------------------------------------------------------------
use GLOBALS;
use OPTIONS;

#----------------------------------------------------------------------
# Initialisations
#----------------------------------------------------------------------

# Default global variables

my $glob = new GLOBALS;

$glob->{GLOBALS_PATH} = "$ENV{HOME}/db/";
$glob->{DEF_GLOBALS} =  $glob->{GLOBALS_PATH} . 'deu/globals.pl';
$glob->requireglob;

# Define a new set of options 

my $OptL = new OPTIONS;

$OptL->groot(string => $GLOBALS::GLOBALS_PATH, Usage => "<dir>\t: global path");
$OptL->lang(string => $GLOBALS::DBLANG, Usage => "<Iso3>\t: language three letters code from Iso 3166/2T");

#----------------------------------------------------------------------
# Command processing
#----------------------------------------------------------------------
$OptL->GetOpt || die "Check your options\n";

# Check arguments
if ($OptL->{groot}{string} ne $GLOBALS::GLOBALS_PATH or 
    $OptL->{lang}{string} ne $GLOBALS::DBLANG ) {
  $glob->{GLOBALS_PATH} = $OptL->{groot}{string};
  $glob->{DEF_GLOBALS}  = $OptL->{groot}{string}. $OptL->{lang}{string} . '/globals.pl';
  $glob->requireglob;
}

# Extract new corpus list
@corpuslist = keys %{$GLOBALS::CORPUS_H};

# Do we have any corpus given ?
if (!$ARGV[0]) {
  warn "Which corpus variables should be printed ?\n";
  warn "@corpuslist\n";
  $OptL->Usage('corpus_name | all','');
}
else {
  $CORPUS = $ARGV[0];
  warn "$CORPUS global variables for language: $OptL->{lang}{string}\n";
}

# Print the variables
if ( exists($GLOBALS::CORPUS_H->{$CORPUS}) or $CORPUS eq 'all') {
  $glob->printglob($CORPUS);
} else {
  die "Error: Corpus $CORPUS unknown\n";
}
__END__

=head1 OPTIONS

The following options are defined:

=over 14

=item -groot I<dir>

global path
(default: $HOME/db/)

=item -lang I<Iso3>

language three letters code from Iso 3166/2T
(default: deu)

=back
